package yxy.cherry.battle.module.record;

import java.util.LinkedList;

import yxy.cherry.battle.module.record.result.BattleResult;
import yxy.cherry.battle.module.record.result.Statistic;
import yxy.cherry.battle.module.record.stream.RecordStream;

public class Record {

	Statistic 统计 = new Statistic();
	BattleResult result = BattleResult.DRAW;
	BattleResult  detailResult  = BattleResult.DRAW;
	int step;// 步数

	public Record() {
	}

	public BattleResult getDetailResult() {
		return detailResult;
	}

	public void setDetailResult(BattleResult detailResult) {
		this.detailResult = detailResult;
	}

	public Statistic get统计() {
		return 统计;
	}

	public BattleResult getResult() {
		return result;
	}

	public void setResult(BattleResult result) {
		this.result = result;
	}

	public void step() {
		step++;
	}

	public int getStep() {
		return step;
	}

	static public void stdout(String str) {
//		System.err.println(">>>" + str);
	}

	// stream ==========================================================
	LinkedList<RecordStream> streamList = new LinkedList<>();

	public String streamInfo() {
		StringBuffer sb = new StringBuffer();
		for (RecordStream stream : streamList) {
			sb.append(stream.info());
		}
		return sb.toString().replaceAll(" ", "");
	}

	public <R extends RecordStream> R stream(R stream) {
		streamList.add(stream);
		return stream;
	}

	StringBuffer streamInfo = new StringBuffer();

	public void info(String info) {
		stdout(info);
		streamInfo.append(info).append(", ");
	}

	public String info() {
		return streamInfo.toString();
	}
}
